<html lang="en">
<header>

</header>

<body>

<form onsubmit="return false">

    <input type="text" id="ss">
    <input type="button" onclick="send_m( document.getElementById('ss').value)">
</form>

<script>
    if (window.WebSocket){
        alert("您的浏览器支持ws")
    }else {
        alert("您的浏览器不支持ws")
    }

    var wb = new WebSocket("ws://localhost:8899/ss")
    wb.onmessage = function (ev) {
        document.getElementById("ss").value = ev.data
    }

    function send_m(msg){
        if (wb.readyState === WebSocket.OPEN){
            wb.send(msg)
        }
    }
</script>
</body>
</html>